Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Membership Block #9802

Merged
merged 63 commits into from
Apr 29, 2019
Merged

Membership Block #9802

merged 63 commits into from
Apr 29, 2019

Conversation

artpi
Copy link
Contributor

@artpi artpi commented Jun 19, 2018

This is the first PR of the block that is intended to provide something that beta users can test. We intend to work in small iterations and we will gladly address feedback in later PRs.

This introduces membership-button block to Jetpack.
This essentially will be a recurring donation button.

Purpose of the code in this PR is to:

  • introduce endpoints that communicate with WPCOM
  • whitelist certain options, CPTs and meta to store / sync data,
  • introduce gutenberg block that uses these endpoints and provides UI to connect to Stripe, create and choose a product
  • introduce a frontend of a block with the sole purpose of displaying a checkout window from wpcom in an iframe

This needs D26086-code . - deployed

Screenshots

Zrzut ekranu 2019-03-27 o 18 17 26

Zrzut ekranu 2019-03-27 o 17 41 59

Zrzut ekranu 2019-03-27 o 17 47 59

Internal references:

p89M8K-4a-p2
p1HpG7-6n6-p2

Testing instructions - Jurassic Ninja

The problem with this is that you can only use real money and real stripe accounts. If you want sandbox payments, you need to use the ngrok flow

  1. https://jurassic.ninja/create/?jetpack-beta&branch=add/memberships
  2. Connect Jetpack, enable "BETA_BLOCKS" in /wp-admin/options-general.php?page=companion_settings
  3. Go to editor
  4. Search for "Membership button" block
  5. You will get a placeholder that will say "connect to stripe", click that
  6. If you correctly set up the store sandbox, you will get "you can skip this form" at the top, click that
  7. You will get redirected to ugly looking page on success
  8. Now go back to gutenberg, click "Re-check Connection", wait
  9. Now you should have a button to add product, click it, fill the form
  10. choose your new product
  11. Publish the page
    12 Go to frontend, click the button that says contribution
  12. go with the flow

Testing instructions - Jetpack Docker

  1. Set up Jetpack with docker and ngrok.io, connnect jetpack
  2. Remember to turn on beta blocks
define( 'GUTENBERG_DEVELOPMENT_MODE', true );
define( 'JETPACK_BETA_BLOCKS', true );
  1. Checkout this PR
  2. Build blocks by
yarn build-extensions
  1. Continue from point 3. in the previous instruction

@artpi artpi requested a review from a team as a code owner June 19, 2018 16:14
@brbrr brbrr added the [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it label Jun 20, 2018
@oskosk
Copy link
Contributor

oskosk commented Jun 28, 2018

@artpi there are a few JS linting messages on the test runs:

modules/memberships/memberships.js
  line 23  col 76  Strings must use singlequote.
  line 24  col 40  Strings must use singlequote.
  line 25  col 97  Strings must use singlequote.
  line 26  col 60  Strings must use singlequote.
  line 26  col 86  Strings must use singlequote.
  line 27  col 29  Strings must use singlequote.
  line 11  col 13  'console' is not defined.
  line 16  col 13  'tb_remove' is not defined.
  line 30  col 13  'tb_show' is not defined.

@stale stale bot added the [Status] Stale label Sep 27, 2018
@jeherve jeherve added the [Block] Payment Button aka Recurring Payments label Sep 27, 2018
@stale stale bot removed the [Status] Stale label Sep 27, 2018
@stale stale bot added the [Status] Stale label Dec 27, 2018
@artpi artpi requested a review from a team March 25, 2019 12:43
@artpi artpi added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack and removed [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it labels Mar 27, 2019
@Automattic Automattic deleted a comment from stale bot Mar 27, 2019
@Automattic Automattic deleted a comment from stale bot Mar 27, 2019
@Automattic Automattic deleted a comment from jetpackbot Mar 27, 2019
@jetpackbot
Copy link

jetpackbot commented Mar 27, 2019

Warnings
⚠️ "Proposed changelog entry" is missing for this PR. Please include any meaningful changes

This is an automated check which relies on PULL_REQUEST_TEMPLATE. We encourage you to follow that template as it helps Jetpack maintainers do their job. If you think 'Testing instructions' or 'Proposed changelog entry' are not needed for your PR - please explain why you think so. Thanks for cooperation 🤖

Generated by 🚫 dangerJS against a2c7318

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor comments, I have not had the time to fully test this yet.

Also, and since we are introducing a bunch a new files, what do you think about adding them all to the pre-commit hook here in Jetpack?

'class.jetpack-plan.php',

We've been trying to do that for all new files to slowly move towards better code coverage in the plugin.

_inc/lib/core-api/wpcom-endpoints/memberships.php Outdated Show resolved Hide resolved
extensions/blocks/membership-button/index.js Show resolved Hide resolved
modules/memberships/class-jetpack-memberships.php Outdated Show resolved Hide resolved
modules/memberships/class-jetpack-memberships.php Outdated Show resolved Hide resolved
modules/module-extras.php Outdated Show resolved Hide resolved
@jeherve jeherve requested a review from a team March 28, 2019 11:10
@jeherve jeherve dismissed their stale review April 29, 2019 21:43

blockers have been fixed

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge this now and address the feedback in future PRs.

It's worth noting that I'm currently having issues inserting new amounts. I get the following JavaScript error when I try to submit a new amount:

Uncaught (in promise) TypeError: Cannot read property 'id' of null
    at eval (edit.jsx:194)

This matches the following error on WordPress.com:

Fatal error: Uncaught Error: Call to undefined method WP_Error::to_array() in [...]jetpack-endpoints/memberships.php:105

@kraftbj kraftbj merged commit e9589a3 into master Apr 29, 2019
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Apr 29, 2019
@kraftbj
Copy link
Contributor

kraftbj commented Apr 29, 2019

Merged, but let's definitely address the API this week (Crew) and this new error asap (@artpi).

@kraftbj kraftbj deleted the add/memberships branch April 29, 2019 22:04
kraftbj added a commit that referenced this pull request Apr 30, 2019
@BurlesonBrad
Copy link

I'm not wanting to go down the coding rabbit hole any more, but here's an innertubes show for ya to see and watch what happens:
http://youtu.be/SNxLOaHWAt8?hd=1

First, It says I'm NOT connected to the Pack-O-Jets. Which, I am!! I've paid for the Premium Jets:
image

After the "You ain't connected to the Packs de La Jets" prompt, the "Connect to Stripe" button can't be clicked at all.

Great, first it prompts me that my Packs don't get to connect with any Jets. And now they don't get to have any Stripes either. Awesomesauce. 😭

I turned on my Beta Blockers and loaded up the Gutenberries as well 👍

image

Well. That didn't help either 😢

So, I decided to retry the Stripes, the Memberships, The Guttenberries, and the PacksOfJets again at 00:36 & still nothing https://youtu.be/SNxLOaHWAt8?t=36

@jeherve
Copy link
Member

jeherve commented May 10, 2019

@BurlesonBrad That error message should be displayed when the user you are logged in with is not linked to any WordPress.com account.

When you originally connected your site to WordPress.com, you did so while logged in as an admin on your site. If another admin wants to use the Memberships block, they'll need to link their own account to WordPress.com first. Does that make sense, and apply to you here, or do you see that error message while logged in with the admin account you used when you first connected your site to WordPress.com?

If the error appears even though the account you are currently logged in with is linked to WordPress.com, could you contact us via this form so we can run more tests with you and get this fixed?

Thank you!

@BurlesonBrad
Copy link

Yessir. In that quick vid and the screenshot as well, both are logged in and connected to the same WP.com account that I've had since dinosaurs roamed the planet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Payment Button aka Recurring Payments [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack Touches WP.com Files [Type] Feature Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.